package com.wahoyu.exportwordtest.controller;

import com.wahoyu.exportwordtest.service.ExportWordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
@RequestMapping("/word")
public class ExportWordController {

    @Autowired
    private ExportWordService exportWordService;

    /**
     * 测试生成word文档并通过Response返回
     * @param response
     * @author wanghongyu02
     * @Date 2025/4/21 09:44
     * @throws IOException
     */
    @GetMapping("/exportWordResponse")
    public void exportWord(HttpServletResponse response) throws IOException {
        exportWordService.exportWord(response);
    }

    /**
     * 手动导出运行报告
     * @author wanghongyu02
     * @throws IOException
     */
    @GetMapping("/exportReportResponse")
    public void exportReport() throws IOException {
        exportWordService.exportOneWord(null, null);
    }



}